﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'userRoleAddWithIds')
	BEGIN
		DROP  Procedure  userRoleAddWithIds
	END
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[userRoleAddWithIds]
	-- Add the parameters for the stored procedure here
	@user_id INT, 
	@role_id INT
AS
BEGIN
	SET NOCOUNT ON;

	-- Insert statements for procedure here
	IF (NOT EXISTS(	SELECT * 
					FROM lit_usuario_rol
					WHERE lit_rol_id = @role_id
					AND lit_usuario_id = @user_id)) 
	BEGIN
		INSERT INTO lit_usuario_rol (lit_usuario_id, lit_rol_id)
		VALUES (@user_id, @role_id);
	END
END
GO